package com.msh.artascope.devcloud.client.po;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.msh.artascope.interfaces.ILoginAccount;
import java.util.Date;
import com.msh.frame.client.base.BasePo;
import com.msh.frame.client.validation.*;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Null;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author shihu
 * @mail m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "jenkins配置Po")
public class JenkinsConfigPo extends BasePo{
  @NotNull(groups = {IUpdateVo.class}, message = "id不能为空")
  @Schema(name = "主键")
  private Long id;

  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 100, message = "address长度范围最大100")
  @Schema(name = "地址")
  private String address;

  @NotNull(groups = {IInsertVo.class},message = "用户名不能为空")
  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 10, message = "username长度范围最大10")
  @Schema(name = "用户名")
  private String username;

  @NotNull(groups = {IInsertVo.class},message = "密码不能为空")
  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 20, message = "password长度范围最大20")
  @Schema(name = "密码")
  private String password;

  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 100, message = "scripGitUrl长度范围最大100")
  @Schema(name = "脚本git地址")
  private String scriptGitUrl;

  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 20, message = "scriptBranch长度范围最大20")
  @Schema(name = "脚本分支")
  private String scriptBranch;

  @NotNull(groups = {IInsertVo.class},message = "环境不能为空")
  @Schema(name = "环境")
  private Long envId;

  @Schema(name = "租户")
  private Long tenantId;

  @NotNull(groups = {IUpdateVo.class}, message = "更新版本不能为空")
  @Schema(name = "更新版本")
  private Integer updateVersion;



  public void initLoginAccount(ILoginAccount loginAccount){
    this.tenantId = loginAccount.getTenantId();
  }
}



